@extends('home.common.common')

@section('title','主页')

@section('content')

     <div class="layui-container">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md8">
                <div class="fly-panel" style="margin-bottom: 0;">
                    <div class="fly-panel-title fly-filter ">

                        <a class=" @if($sortData['sort_field']=='created_at') layui-this @endif" 
                            href="{{route(
                                'home/article/index',
                                [
                                    'sort_field'=>'created_at',
                                    'sort_type'=> $sortData['sort_type'],   
                                    'search_field'=>$searchData['search_field'],
                                    'search_content'=>$searchData['search_content'],
                                ]
                            )}}"
                        >
                            按最新
                        </a>

                        <span class="fly-mid">
                        </span>
               
                        <a class="@if($sortData['sort_field']=='click') layui-this  @endif"  href="{{route(
                                'home/article/index',
                                [
                                    'sort_field'=>'click',
                                    'sort_type'=> $sortData['sort_type'],    
                                    'search_field'=>$searchData['search_field'],
                                    'search_content'=>$searchData['search_content'],
                                ]
                            )}}">
                            按点击
                        </a>
                        
                    </div>
                    @if($articleList->total())
                    <ul class="fly-list">
                    	@foreach($articleList as $k => $v)
                        <li>
                            <a class="fly-avatar" href="user/home.html">
                                <img alt="贤心" src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg">
                                </img>
                            </a>
                            <h2>
                                <a class="layui-badge">
                                    {{$v->category->title}}
                                </a>
                                <a href="{{url('home/article/detail',[$v['id']])}}">
                                    {{$v['title']}}
                                </a>
                            </h2>
                            <div class="fly-list-info">
                      
                                <span>
                                    {{$v['created_at']}}
                                </span>
                                <span class="fly-list-kiss layui-hide-xs" title="">
                                    <i class="iconfont icon-liulanyanjing">
                                    </i>
                                    {{$v['click']}}
                                </span>
                                <span class="fly-list-nums">
                                <!--     <i class="iconfont icon-pinglun1" title="回答">
                                    </i>
                                    66 -->
                                </span>
                            </div>
                            <div class="fly-list-badge">
                                <!-- <span class="layui-badge layui-bg-red">精帖</span> -->
                            </div>
                        </li>
                        @endforeach
                    </ul>
                    @else
                    <div class="fly-none">没有相关数据</div>  
                    @endif
                    <div style="text-align: center">
                       {{ $articleList->render() }}
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection